package mysql

import "gorm.io/gorm"

type House struct {
	gorm.Model
	HouseTitle   string  `gorm:"type:varchar(50);not null;comment:'标题'"`
	HouseAddress string  `gorm:"type:varchar(100);not null;comment:'地址'"`
	HouseIntro   string  `gorm:"type:varchar(100);not null;comment:'描述'"`
	HousePrice   float64 `gorm:"type:double(10,2);not null;comment:'价格'"`
}

func (h *House) Create() error {
	return DB.Create(&h).Error
}

func (h *House) GetList(id int64) error {
	return DB.Where("id = ?", id).Limit(1).Find(&h).Error
}
